﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BMSQ.Utility;

namespace BMSQ.Admin.Accounts.Role
{
    public partial class Add : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtRoleName.Text.Trim().Length == 0)
            {
                strErr += "RoleName不能为空！\\n";
            }
            if (this.txtDescription.Text.Trim().Length == 0)
            {
                strErr += "Description不能为空！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string RoleName = this.txtRoleName.Text;
            string Description = this.txtDescription.Text;

            Vincent.Permission.Model.account_roles model = new Vincent.Permission.Model.account_roles();
            model.RoleID = DBParameter.GetGuid();
            model.RoleName = RoleName;
            model.Description = Description;

            Vincent.Permission.Functions.Account.AddRole(model);
            MessageBox.ShowAndRedirect(this, "保存成功！", "add.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}